#ifndef COMPILER_H_
#define COMPILER_H_

#include <string>
#include "Buffer.h"
#include "Token.h"
#include "IntegerToken.h"

using namespace std;

class Compiler
{
    Buffer script;
    
public:
    Compiler(char* script_raw_data);
    virtual ~Compiler();

    unsigned int get_parsing_offset();

    bool at_cpp_comment();
    void skip_cpp_comment();

    bool at_c_comment();
    bool at_c_comment_end();
    void skip_c_comment();

    bool at_true_whitespace();
    bool at_whitespace();
    void skip_whitespace();

    bool at_end();
    Token get_token();
    Token look_ahead();

    bool at_identifier_initiator();
    bool at_identifier();
    Token get_identifier();

    bool at_number();
    IntegerToken get_number();

    bool at_symbol();
    Token get_symbol();

    bool at_string_literal();
    Token get_string_literal();

    void expect(std::string token_text);

    bool parse_event();
    bool is_library_function(Token token);
    int parse_expression();
    int parse_term();
    int parse_factor();
};

#endif /*COMPILER_H_*/
